home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / g++ / SmplStat.h < prev    next >
C/C++ Source or Header  |  1995-02-06  |  2KB  |  68 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /* 
  3. Copyright (C) 1988 Free Software Foundation
  4.     written by Dirk Grunwald (grunwald@cs.uiuc.edu)
  5.  
  6. This file is part of the GNU C++ Library.  This library is free
  7. software; you can redistribute it and/or modify it under the terms of
  8. the GNU Library General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.  This library is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE.  See the GNU Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18. #ifndef SampleStatistic_h
  19. #ifdef __GNUG__
  20. #pragma interface
  21. #pragma cplusplus
  22. #endif
  23. #define SampleStatistic_h 1
  24.  
  25. #include <builtin.h>
  26.  
  27. class SampleStatistic {
  28. protected:
  29.     int    n;
  30.     double x;
  31.     double x2;
  32.     double minValue, maxValue;
  33.  
  34.     public :
  35.  
  36.     SampleStatistic();
  37.     virtual ~SampleStatistic();
  38.     virtual void reset(); 
  39.  
  40.     virtual void operator+=(double);
  41.     int  samples();
  42.     double mean();
  43.     double stdDev();
  44.     double var();
  45.     double min();
  46.     double max();
  47.     double confidence(int p_percentage);
  48.     double confidence(double p_value);
  49.  
  50.     void            error(const char* msg);
  51. };
  52.  
  53. // error handlers
  54.  
  55. extern  void default_SampleStatistic_error_handler(const char*);
  56. extern  one_arg_error_handler_t SampleStatistic_error_handler;
  57.  
  58. extern  one_arg_error_handler_t 
  59.         set_SampleStatistic_error_handler(one_arg_error_handler_t f);
  60.  
  61. inline SampleStatistic:: SampleStatistic(){ reset();}
  62. inline int SampleStatistic::  samples() {return(n);}
  63. inline double SampleStatistic:: min() {return(minValue);}
  64. inline double SampleStatistic:: max() {return(maxValue);}
  65. inline SampleStatistic::~SampleStatistic() {}
  66.  
  67. #endif
  68.